import Vue from 'vue'
import store from '@/store'
import router from '@/router'
// 按钮权限
Vue.directive('auth', {
  inserted(el, binds) {
    let url = new URL(el.href)
    let pathname = url.pathname

    let routes = router.options.routes[0].children.map(item => '/admin/' + item.path)
    // console.log(binds.value, routes);
    if (!routes.includes(pathname)) {
      el.parentNode.removeChild(el)
    }
  }
})